import Vue from 'vue'
import Router from 'vue-router'
import war from '@/components/War'
import login from '@/components/Login'
import log from '@/components/page/Log'
import reg from '@/components/page/Reg'
import wpas from '@/components/page/Wpas'
import echart from '@/components/page/echart'
import biao from '@/components/page/biao'
import game from '@/components/page/game'
import xiangqi from '@/components/page/xiangqi'
import biaotou from '@/components/page/biaotou'

Vue.use(Router)

export default new Router({
  // mode: 'history',
  // srcollBehavior(to, from, savedPosition) {
  //   if (to.hash) {
  //     return {
  //       selector: to.hash
  //     }
  //   }
  // },
  routes: [
    {
      path: '/war',
      name: 'war',
      component: war
    },
    {
      path: '/',
      name: 'login',
      component: login,
      redirect: '/xiangqi',
      children: [
        {
          path: '/log',
          name: 'log',
          component: log,
        },
        {
          path: '/wpas',
          name: 'wpas',
          component: wpas,
        },
        {
          path: '/reg',
          name: 'reg',
          component: reg,
        },
        {
          path: '/echart',
          name: 'echart',
          component: echart,
        },
        {
          path: '/biao',
          name: 'biao',
          component: biao,
        },
        {
          path: '/game',
          name: 'game',
          component: game,
        },
        {
          path: '/xiangqi',
          name: 'xiangqi',
          component: xiangqi,
        },
        {
          path: '/biaotou',
          name: 'biaotou',
          component: biaotou,
        },
      ]
    },
    {
      path: "*", // 此处需特别注意置于最底部
      component:Error

    }
  ]
})
